
import store from '@/store'

// token的三个方法
// 设置
const setToken = (tokenStr) => {
  store.commit('user/setToken', tokenStr)
}
// 获取
const getToken = () => store.state.user.token
// 删除
const removeToken = () => {
  store.commit('user/setToken', '')
}
// refreshToken的三个方法
// 设置
const setRefreshToken = (refreshTokenStr) => {
  store.commit('user/setRefreshToken', refreshTokenStr)
}
// 获取
const getRefreshToken = () => store.state.user.refreshToken
// 删除
const removeRefreshToken = () => {
  store.commit('user/setRefreshToken', '')
}

// 导出
export {
  setToken,
  getToken,
  removeToken,
  setRefreshToken,
  getRefreshToken,
  removeRefreshToken
}
